package 第三;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/s1")
public class Servlet2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");

        System.out.println("do....................post");
        String username=req.getParameter("username");
        String password=req.getParameter("password");
        String hobby=req.getParameter("hobby");
        String gender=req.getParameter("gender");

        System.out.println("账号:"+username);
        System.out.println("密码:"+password);
        System.out.println("性别:"+gender);
        System.out.println("爱好:"+hobby);
    }
}
